using UnityEngine;
using System.Collections;

public class ClassArrow : MonoBehaviour
{
    public bool bRightArrow;
    bool bBtnDisabled;
    // Use this for initialization
    void Start()
    {
        bBtnDisabled = true;
    }

    // Update is called once per frame
    void Update()
    {

    }

    void OnClick()
    {
        if (!bBtnDisabled)
        {

            UnitData CurSelUnit = GameObject.Find("ShopWdw(Clone)").GetComponent<HireWindow>().m_HireList[GameObject.Find("RightWdw").GetComponent<RightWdwMgr>().CurApplicationNum];

            if (bRightArrow)
            {
                if (CurSelUnit.ClassStatus.enClass != CLASS_TYPE.TECHNICIAN)
                {
                    if ((ASSN_TYPE)((int)CurSelUnit.ClassStatus.AssnStatus.enAssnType + 1) == ASSN_TYPE.END)
                        CurSelUnit.ClassStatus = GameObject.Find("DataLogic").GetComponent<DataManager>().GetClassData(CurSelUnit.ClassStatus.enClass, (ASSN_TYPE)((int)0)
                                                                                      , 0);
                    else
                        CurSelUnit.ClassStatus = GameObject.Find("DataLogic").GetComponent<DataManager>().GetClassData(CurSelUnit.ClassStatus.enClass, (ASSN_TYPE)((int)CurSelUnit.ClassStatus.AssnStatus.enAssnType + 1)
                                                                                 , 0);
                }
                else
                {
                    if ((ASSN_TYPE)((int)CurSelUnit.ClassStatus.AssnStatus.enAssnType + 1) == ASSN_TYPE.CLOSE)
                        CurSelUnit.ClassStatus = GameObject.Find("DataLogic").GetComponent<DataManager>().GetClassData(CurSelUnit.ClassStatus.enClass, (ASSN_TYPE)((int)0)
                                                                                      , 0);
                    else
                        CurSelUnit.ClassStatus = GameObject.Find("DataLogic").GetComponent<DataManager>().GetClassData(CurSelUnit.ClassStatus.enClass, (ASSN_TYPE)((int)CurSelUnit.ClassStatus.AssnStatus.enAssnType + 1)
                                                                                 , 0);
                }

                GameObject.Find("FileCover(Clone)").GetComponent<FileCover>().RightArrow();

            }
            else
            {
                if (CurSelUnit.ClassStatus.enClass != CLASS_TYPE.TECHNICIAN)
                {
                    if ((int)CurSelUnit.ClassStatus.AssnStatus.enAssnType == 0)
                        CurSelUnit.ClassStatus = GameObject.Find("DataLogic").GetComponent<DataManager>().GetClassData(CurSelUnit.ClassStatus.enClass, (ASSN_TYPE)((int)ASSN_TYPE.END - 1)
                                                                                      , 0);
                    else
                        CurSelUnit.ClassStatus = GameObject.Find("DataLogic").GetComponent<DataManager>().GetClassData(CurSelUnit.ClassStatus.enClass, (ASSN_TYPE)((int)CurSelUnit.ClassStatus.AssnStatus.enAssnType - 1)
                                                                                  , 0);
                }
                else
                {
                    if ((int)CurSelUnit.ClassStatus.AssnStatus.enAssnType == 0)
                        CurSelUnit.ClassStatus = GameObject.Find("DataLogic").GetComponent<DataManager>().GetClassData(CurSelUnit.ClassStatus.enClass, (ASSN_TYPE)((int)ASSN_TYPE.END - 2)
                                                                                      , 0);
                    else
                        CurSelUnit.ClassStatus = GameObject.Find("DataLogic").GetComponent<DataManager>().GetClassData(CurSelUnit.ClassStatus.enClass, (ASSN_TYPE)((int)CurSelUnit.ClassStatus.AssnStatus.enAssnType - 1)
                                                                                  , 0);
                }

                GameObject.Find("FileCover(Clone)").GetComponent<FileCover>().LeftArrow();
            }
            GameObject.Find("ClassArrows(Clone)").transform.GetChild(0).GetComponent<ClassArrow>().ButtonStatus(false);
            GameObject.Find("ClassArrows(Clone)").transform.GetChild(1).GetComponent<ClassArrow>().ButtonStatus(false);
            GameObject.Find("HireApply(Clone)").GetComponent<HireApply>().ButtonStatus(false);
        }
    }

    public void ButtonStatus(bool bStatus)
    {
        bBtnDisabled = bStatus ? false : true;
    }
}

